<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019-02-12
 * Time: 10:34
 */

namespace app\index\controller;


use app\common\controller\HomeBase;

class Article extends  HomeBase
{

    /**
     * 获取所有的文章类型
     */
    public function getArticleList($page = 1)
    {
        $list = \app\common\model\Article::getList($page);
        if (sizeof($list) > 0) {
            return json(['code' => 200, 'msg' => $list]);
        }
        return json(['code' => 300, 'msg' => "暂无数据"]);
    }
    /**
     * 根据不同类型的ID  查看该类型下面的帮助文章
     */
    public function getdetail()
    {
        $params = input();
        if(array_key_exists("a_id",$params) && $params['a_id'] != ''){
            $detail = \app\common\model\Article::getContent($params['a_id']);
            return json(['code' => 200, 'msg' => $detail]);

        } else {
            return json(['code' => 300, 'msg' => '未登录']);
        }
    }
}